package com.ty.controller;

import com.ty.entity.VendorQuery;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.ty.entity.Vendor;
import com.ty.service.VendorService;

import java.util.List;


@RestController
@RequestMapping("/api/vendor")
public class VendorController{
    @Autowired
    private VendorService vendorService;

    @GetMapping
    public List<Vendor> select(VendorQuery query){
        return vendorService.select(query);
    }

    @PostMapping
    public Integer insert(@RequestBody Vendor vendor){
        return vendorService.insert(vendor);
    }

    @PutMapping
    public Integer uplate(@RequestBody Vendor vendor){
        return vendorService.update(vendor);
    }

    @DeleteMapping
    public Integer delete(Integer id){
        return vendorService.delete(id);
    }
}